/**
 * Created by dylan_Apple on 17/6/25.
 */
var async = require('async');
var http=require('http');

var searchCtrl = require('../controller/controller.search');

var user = require('../controller/controller.user');

module.exports = {
    //按key查询关键字列表
    keysearch: function (req, res, next) {
        var params = req.body;
        if (!params.key) return;
        searchCtrl.keysearch(params, function (err, result) {
            if (err) {
                res.redirect('/error');
                return;
            }
            next({
                    'searchList': result.obj
                }
            );
        })
    },
//按指定字段查询
    searchList: function (req, res, next) {
        var params = req.body;
        if (!params.params.key||!params.params.type) return;
        searchCtrl.searchList(params.params, function (err, result) {
            if (err) {
                res.redirect('/error');
                return;
            }
            next( result);
        })
    },


};

